package vip.xiaonuo.smzq.modular.jsc.controller;

import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.jsc.entity.Xxlb;
import vip.xiaonuo.smzq.modular.jsc.service.IXxlbService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;


/**
 * 驾驶舱消息列表
 *
 * @author sqq
 * @since 2024-05-15
 */
@Api(tags = "驾驶舱消息列表")
@RestController
@RequestMapping("/jsc/xxlb")
@Validated
public class XxlbController {

    @Resource
    private IXxlbService iXxlbService;

    /**
     * 添加驾驶舱消息列表
     */
    @ApiOperation("添加驾驶舱消息列表")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid Xxlb xxlb) {
        iXxlbService.add(xxlb);
        return CommonResult.ok();
    }

    /**
     * 添加驾驶舱消息列表
     */
    @ApiOperation("添加驾驶舱热点矿产列表")
    @PostMapping("/addRdkc")
    public CommonResult<String> addRdkc(@RequestBody @Valid List<Xxlb> xxlbList) {
        iXxlbService.addRdkc(xxlbList);
        return CommonResult.ok();
    }

    /**
     * 删除驾驶舱消息列表
     */
    @ApiOperation("删除驾驶舱消息列表")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iXxlbService.removeById(pkid);
        return CommonResult.ok();
    }

    /**
     * 编辑驾驶舱消息列表
     */
    @ApiOperation("编辑驾驶舱消息列表")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid Xxlb xxlb) {
        iXxlbService.updateById(xxlb);
        return CommonResult.ok();
    }

    /**
     * 驾驶舱消息列表查询
     */
    @ApiOperation("驾驶舱消息查询")
    @GetMapping("/xxlbList")
    public CommonResult<List<Xxlb>> xxlbList(Integer nd,String xzqhDm,Integer xxlx) {
        return CommonResult.data(iXxlbService.xxlbList(nd,xzqhDm,xxlx));
    }
}
